<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.enterprise.daoImpl.NodeDaoImpl"%>
<%@page import="com.enterprise.daoImpl.NewsDaoImpl"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.util.*,com.enterprise.domain.*" pageEncoding="UTF-8"%>
<%@include file="Inc/Head.jsp" %>
 <%! List<News> news=null; %>
<SCRIPT language=javascript> 
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}
 
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的新闻吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}
 
</SCRIPT>
 
<script language="javascript"> 
<!--  
  if (window == top)top.location.href = "Default.asp"; 
// -->
</script>
<html>
<head>
<title>网站管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css"> 
<!--
.back_southidc{BACKGROUND-IMAGE:url('image/titlebg.gif');COLOR:000000;}
.table_southidc{BACKGROUND-COLOR: A4B6D7;}
.td_southidc{BACKGROUND-COLOR: F2F8FF;}
.tr_southidc{BACKGROUND-COLOR: ECF5FF;}
 
.t1 {font:12px 宋体;color:#000000} 
.t2 {font:12px 宋体;color:#ffffff} 
.t3 {font:12px 宋体;color:#ffff00} 
.t4 {font:12px 宋体;color:#800000} 
.t5 {font:12px 宋体;color:#191970} 
 
.weiqun:hover{
	Font-unline:yes;
	font-family: "宋体";
	color: #FFFFFF;
	text-decoration: underline;
	background-color: #CCCCCC;
}
td {
	font-size: 12px;
}
 
a:link {
	color: #000000;
	text-decoration: none;
}
a:active {
	color: #000000;
	text-decoration: none;
}
a:visited {
	color: #000000;
	text-decoration: none;
}
.tit {
	font-size: 14px;
}
-->
</style>
<body>
 
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top"> <br> <p align="center"><strong>新 
        闻 资 讯 管 理</strong></p>
      <table width="620" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#000000" class="border">
        <tr class="title"> 
          <td bgcolor="#A4B6D7" height="25">|&nbsp;
          <% 
          		NewsDaoImpl newsDaoImpl=new NewsDaoImpl();
          		NodeDaoImpl nodeDaoImpl=new NodeDaoImpl();
          		int b=1;
          		String str=request.getParameter("BigClassName");
          		if(str!=null&&!str.equals(""))
          			b=Integer.parseInt(str);
          	
          		List<Node> nodes=nodeDaoImpl.getNodes(-1);
          		if(nodes!=null&&nodes.size()>0){
          				for(Node node:nodes){
          		
           %> 
            <a href='News_Manage.jsp?BigClassName=<%=node.getId()%>'><%=node.getClassName()%></a> |
            <%}} %>
          </td>
        </tr>
        
        
      </table>
      <form name="del" method="Post" action="News_Del.asp" onsubmit="return ConfirmDel();">
        <table width="620" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
          <tr bgcolor="#A4B6D7"> 
            
            <%if(str==null){ %>
            <td height="25"><a href="News_Manage.jsp">&nbsp;新闻资讯管理</a> &gt;&gt;
            	所有新闻 </td>
            		<td width="150">&nbsp; 
           		共有找到<%=newsDaoImpl.getNewsList().size() %>条新闻</td>
          		</tr>
          		<%
          			news=newsDaoImpl.getNewsList();
          			
          		 %>
            <%}else{ %> 
            
                <td height="25"><a href="News_Manage.jsp">&nbsp;新闻资讯管理</a> &gt;&gt;
            	所有新闻 </td>
            		<td width="150">&nbsp; 
           		共有找到<%=newsDaoImpl.getNewsListById(b).size() %>条新闻</td>
          		</tr>
            	<%
            		news=newsDaoImpl.getNewsListById(b);
            		
            	 %>
       			<%} %>
              
        </table>
        
        <table width="620" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" class="border" style="word-break:break-all">
          <tr bgcolor="#A4B6D7" class="title"> 
            <td width="36" height="25" align="center">选中</td>
            <td width="40"  height="25" align="center">ID</td>
            <td width="246" align="center" bgcolor="#A4B6D7" >新闻标题</td>
            <td width="81" align="center" >所属一级分类</td>
            <td width="76" align="center" >所属二级分类</td>
            <td width="57" align="center" >加入时间</td>
            <td width="68" align="center" >操作</td>
          </tr>
          <% for(News n: news) {%>
          
          <tr class="tdbg"> 
            <td width="36" height="22" align="center" bgcolor="#A4B6D7"> 
              <input name='ID' type='checkbox' onclick="unselectall()" id="ID" value='<%=n.getId()%>'>
            </td>
            <td width="40" align="center" bgcolor="#ECF5FF"><%=n.getId() %></td>
            <td  bgcolor="#ECF5FF"><a href="<%=basePath %>shownews.jsp?id=<%=n.getId()%>"><%=n.getTitle() %></a></td>
            <td  bgcolor="#ECF5FF">
<div align="center"><%=n.getBigClassName() %></div></td>
            <td  bgcolor="#ECF5FF">
<div align="center"><%=n.getSecondClassName() %></div></td>
            <td align="center" bgcolor="#ECF5FF"><%=new SimpleDateFormat("yyyy-MM-dd").format(n.getAddDate())%></td>
            <td width="68" align="center" bgcolor="#ECF5FF"> <a href="News_modi.jsp?ID=<%=n.getId()%>">修改</a> 
              <a href="news-delete.action?id=<%=n.getId() %>" onclick="return ConfirmDel();">删除</a> 
            </td>
          </tr>
          
          <%} %>
          
        </table>
        <table width="620" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="250" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页显示的所有新闻</td>
            <td><input name="submit" type='submit' value='删除选定的新闻'> 
              <input name="Action" type="hidden" id="Action" value="Del"></td>
          </tr>
        </table>
        <table align='center'><form name='showpages' method='Post' action='News_Manage.asp?BigClassName=&SmallClassName='><tr><td>共 <b>14</b> 条新闻&nbsp;&nbsp;首页 上一页&nbsp;下一页 尾页&nbsp;页次：<strong><font color=red>1</font>/1</strong>页 &nbsp;<b>20</b>条新闻/页</td></tr></form></table>
      </form>
      <br> <table width="620" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr class="tdbg"> 
          <form name="searchsoft" method="get" action="News_Manage.asp">
            <td height="30"> <strong>查找新闻：</strong> <input name="Title" type="text" class=smallInput id="Title3" size="20" maxlength="50"> 
              <input name="Query" type="submit" id="Query" value="查 询"> &nbsp;&nbsp;请输入新闻名称。如果为空，则查找所有新闻。</td>
          </form>
        </tr>
      </table></td>
  </tr>
</table>
 
</body>
</html>

<%@include file="Inc/Foot.jsp"%>